package com.hxkj.client.service;

import com.hxkj.domain.po.Resources;
import com.hxkj.domain.po.ResourcesTree;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultMessageStruct;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * @author YAOSY
 * @create 2018年6月6日
 * @desc 资源对外接口
 **/

@FeignClient(name = "cms-management")
public interface ResourcesServiceClient {


    /**
     * 新建文件资源
     *
     * @param resources 模板信息
     * @throws Exception
     */
    @RequestMapping(value = "/resources/saveResources", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultDataStruct<Resources> saveResources(@RequestBody Resources resources) throws Exception;



    /**
     * 新建目录资源
     *
     * @param resources 目录信息
     * @throws Exception
     */
    @RequestMapping(value = "/resources/saveResourcesFolder", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultDataStruct<Resources> saveResourcesFolder(@RequestBody Resources resources) throws Exception;


    /**
     * 资源功能树
     *
     * @param resources
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/resources/getResourcesTree", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
    ResultDataStruct<List<ResourcesTree>> getResourcesTree(@RequestBody Resources resources) throws Exception;


    /**
     * 删除资源
     *
     * @param resources 目录信息
     * @throws Exception
     */
    @RequestMapping(value = "/resources/remove", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultMessageStruct remove(@RequestBody Resources resources) throws Exception;


    /**
     * 获取单条资源数据
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/get", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultDataStruct get(@RequestBody Resources resources) throws Exception;


    /**
     * 保存单条资源文件
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/modify", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultMessageStruct modify(@RequestBody Resources resources) throws Exception;


    /**
     *资源上传
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/upload", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultMessageStruct upload(@RequestBody Resources resources) throws Exception;



    /**
     * 模板上传后需要保存的信息
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/saveUploadContent", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultDataStruct<Resources> saveUploadContent(@RequestBody Resources resources) throws Exception;


    /**
     *  根据站点获取所有的模板文件
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/getResourcesBySiteId", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultDataStruct<List<Resources>> getResourcesBySiteId(@RequestBody Resources resources) throws Exception;

    /**
    * @author Mr.zheng
    * @Description modifyResourcesMd5 修改添加资源文件的MD5值
    * @Date 10:06 2018/8/20
    * @Param [resources]
    * @return com.platform.common.domain.result.ResultDataStruct
    **/
    @RequestMapping(value = "/resources/modifyResourcesMd5", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    ResultMessageStruct modifyResourcesMd5(@RequestBody Resources resources) throws Exception;



    /**
     *  匹配文件路径
     *
     * @param resources
     * @throws Exception
     */
    @RequestMapping(value = "/resources/selectContainPathFolder", method = RequestMethod.POST,consumes = "application/json;charset=UTF-8")
    List<Resources> selectContainPathFolder(@RequestBody Resources resources) throws Exception;
}
